﻿# ATM取款

# 定义一个字典，

Moy_user_list = [
    {'id':'0001', 'ree_d': 123, 'name': 'zhangsan', 'money': '10000'},
    {'id': '0002', 'ree_d': 456, 'name': 'xiaohong', 'money': '20000'},
    {'id': '0002', 'ree_d': 456, 'name': 'xiaohong', 'money': '20000'}]
ree_d = input('请输入账号：')
Pass_w = input('请输入密码：')

# 判断账号和密码是否输入正确]
for v in range(len(Moy_user_list)):
    if Moy_user_list[v]['id'] == ree_d and Moy_user_list[v]['ree_d'] == Pass_w:
        success = 9
        print('登录成功')
    else:
        break
    print('请重新输入账号和密码：')
print('='*20,'请选择一下操作','='*20)
print('请选择：')
print('1.查询余额')
print('2.存钱')
print('3.取钱')
print('4.退出')

# 定义输入的
usre_key = int(input('请输入操作的项目:'))

# 查询余额
# Money = 0
Money = int(input('请输入存款金额：'))
for ert_sre in range(len(Moy_user_list)):

    if ree_d == Moy_user_list[ert_sre]['id']:
        if usre_key == 1:
            print('账户余额为{}：'.format(Moy_user_list[ert_sre]['money']))
            break
# 存钱

        elif usre_key == 2:

            newmon = int(Moy_user_list[ert_sre]['money'])
            Money= Money+newmon
            print('存款成功,余额为{}：'.format(Money, Moy_user_list[ert_sre]['money']))
            break
# 取钱
        elif usre_key == 3:
            newmon = int(Moy_user_list[ert_sre]['money'])
            Money = newmon-Money
            print('取款成功，余额为{}：'.format(Money, Moy_user_list[ert_sre]['money']))

            break
# 退出
        else:
            def loginOut():
                pass




